package com.ming.DaoImp;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * Created by Administrator on 2018/8/4 0004.
 */
public class a {
    public static void main(String[] rags) throws ParseException {
        long date = System.currentTimeMillis();
        String data = "2018-8-11 00:00:00";
        DateFormat ds = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        long com = ds.parse(data).getTime() - date;
        long day = com/1000/60/60/24;
        System.out.println(day);
    }
   /*     // TODO Auto-generated method stub
        String date = "2018-8-10 20:35:09";
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        System.out.println(subSystemTime(df.parse(date)));
    }
    *//**
     * 一个自定义日期与当前系统日期相减
     *
     * @param date 自定义日期
     * @return
     *//*
    public static long subSystemTime(Date date){
        StringBuilder sb = new StringBuilder();
        long year,month,day,hour,minute,second;
        long milliSecondSub = date.getTime()-System.currentTimeMillis();
        if(milliSecondSub<0){
            milliSecondSub = -milliSecondSub;
            sb.append("-");
        }
      *//*  second = milliSecondSub/1000%60;
        minute = milliSecondSub/1000/60%60;
        hour = milliSecondSub/1000/60/60%24;*//*
        day = milliSecondSub/1000/60/60/24;
        //sb.append(day).append("天").append(hour).append("小时").append(minute).append("分钟").append(second).append("秒");
        return day;
    }*/


    }
